package FourArithmeticOperations;

/**
 * Created by dell on 2017/10/23.
 */
public class erchashu {


    private Node root;


    private class Node {
        private Node left;
        private Node right;
        private int data;

        public Node(int data) {
            this.left = null;
            this.right = null;
            this.data = data;
        }
    }

    public void BinaryTree() {
        root = null;
    }

    public void buildTree(Node node, int data) {
        if (root == null) {
            root = new Node(data);
        } else {
            if (data < node.data) {
                if (node.left == null) {
                    node.left = new Node(data);
                } else {
                    buildTree(node.left, data);
                }
            } else {
                if (node.right == null) {
                    node.right = new Node(data);
                } else {
                    buildTree(node.right, data);
                }
            }
        }
    }
}
